package kr.hkit.powerjava.chapter22.work;

import java.util.ArrayList;

public class StudentManager {

	private ArrayList<Student> arList;

	
	public StudentManager() {
		arList = new ArrayList<>();
	}


	public StudentManager(ArrayList<Student> arList) {
		this.arList = arList;
	}
	
	public void addStudnet(Student std){
		arList.add(std);
	}
	
	public void delStudent(Student std){
		if(arList.contains(std)){
			arList.remove(arList.indexOf(std));
		}else{
			System.out.println("해당 학생 정보 없음");
		}
	}
	
	public void prnList(){
		System.out.println("------------------------------------------------------");
		prnHeader();
		for(Student std: arList){
			System.out.println(std);
		}
	}
	
	private static void prnHeader() {
		String header = String
		.format("%3s\t%5s\t%3s\t%3s\t%3s\t%4s\t%5s",
				"학번", "성명", "국어", "영어", "수학", "총점", "평균");
		System.out.println(header);
	}
	
}
